<h1>{PAGE_TITLE}</h1>
{PAGE_CONTENT}
<div id="confirmed"></div>
<div id="error"></div>
<form id="contact_form" method="post" action="contact">	
	<div id="contact_content">
		<div class="new_field">
			<div class="form_name">Naam:</div>
			<div class="form_input"><input type="text" name="name" class="contact_text" id="name" value="" /></div>
		</div>
		
		<div class="new_field">
			<div class="form_name">E-mail:</div>
			<div class="form_input"><input type="text" name="email" class="contact_text" id="email" value="" /></div>
		</div>
		
		<div class="new_field">
			<div class="form_name">Onderwerp:</div>
			<div class="form_input"><input type="text" name="subject" class="contact_text" id="subject" value="" /></div>
		</div>
		
		<div class="new_field">
			<div class="form_name">Bericht:</div>
			<div class="form_input" id="form_textarea"><textarea name="message" id="message"></textarea></div>
		</div>
		
		<div class="new_field">
			<div class="form_name">&nbsp;</div>
			<div class="new_buttons">
				<input type="reset" name="reset" value="Velden Wissen" /> <input type="submit" name="submit" value="Verzenden" id="contact_submit" />
			</div>
		</div>
	</div>
</form>
<script type="text/javascript">
  // attach a submit handler to the form
  $("#contact_form").submit(function(event) {	

    // stop form from submitting normally
    event.preventDefault(); 
        
    // get some values from elements on the page:
    var $form = $( this ),
        t_name = $form.find('input[name="name"]').val(),
        t_email = $form.find('input[name="email"]').val(),
        t_subject = $form.find('input[name="subject"]').val(),
        t_message = $form.find('textarea[name="message"]').val(),
        url = $form.attr( 'action' );
        
        $("input, textarea").css("background", "#FFFFFF");
        
        var GoedGekeurd = true;
		var FoutMelding = '';
		var emailFilter = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
		if (t_name == '') { 
			var GoedGekeurd = false; 
			$form.find('input[name="name"]').css('background', '#ff5252');
			var FoutMelding = FoutMelding + '<li>Uw naam.</li>';
		}
		
		if (t_email == '') { 
			var GoedGekeurd = false; 
			$form.find('input[name="email"]').css('background', '#ff5252');
			var FoutMelding = FoutMelding + '<li>Uw emailadres.</li>';
		}
		
		if (t_subject == '') { 
			var GoedGekeurd = false; 
			$form.find('input[name="subject"]').css('background', '#ff5252');
			var FoutMelding = FoutMelding + '<li>Uw onderwerp.</li>';
		}
		
		if (t_message == '') { 
			var GoedGekeurd = false; 
			$form.find('textarea[name="message"]').css('background', '#ff5252');
			var FoutMelding = FoutMelding + '<li>Uw bericht.</li>';
		}
		
		if (GoedGekeurd == false)
		{
			$("#error").html("U heeft de volgende formulieren niet of onjuist ingevuld!<br /><ul>"+FoutMelding+"</ul>");
			$("#error").show();
			return false;
		}
		else
		{
	    // Send the data using post and put the results in a div
	    $.post( url, { name: t_name, email: t_email, subject: t_subject, message: t_message, submit: true } ,
	      function( data ) {
	          var content = $( data ).find( '#content' );
	          $("#confirmed").html( "Het bericht is succesvol verstuurd!" );
	          $("#contact_content").html("");
	          $("#error").hide();
	          $("#confirmed").show();
	      });
	    }
  });
</script>